.video-player-container {
  position: relative;
  width: 100%;
  background-color: #000;

  .course-video {
    width: 100%;
    height: 422rpx; // 16:9比例
  }

  .ad-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%; // 广告宽度占视频宽度的60%
    height: 70%; // 广告高度占视频高度的60%
    z-index: 999;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 12rpx;
    overflow: hidden;
    animation: fadeIn 0.3s ease;

    .ad-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .ad-tag {
      position: absolute;
      top: 16rpx;
      right: 16rpx;
      background: rgba(0, 0, 0, 0.5);
      color: #fff;
      font-size: 20rpx;
      padding: 4rpx 12rpx;
      border-radius: 4rpx;
    }

    .swiper-indicator {
      position: absolute;
      right: 16rpx;
      bottom: 16rpx;
      background: rgba(0, 0, 0, 0.5);
      color: #fff;
      font-size: 24rpx;
      padding: 4rpx 12rpx;
      border-radius: 20rpx;
    }


    .close-btn {
      position: absolute;
      top: 16rpx;
      left: 16rpx;
      width: 44rpx;
      height: 44rpx;
      background: rgba(0, 0, 0, 0.5);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;

      .close-icon {
        color: #fff;
        font-size: 28rpx;
        text-align: center;
      }
    }
  }

  .definition-btn {
    position: absolute;
    right: 20rpx;
    bottom: 100rpx;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 30rpx;
    padding: 8rpx 20rpx;
    z-index: 10;

    .current-definition {
      color: #fff;
      font-size: 24rpx;
    }
  }

  .definition-selector {
    position: absolute;
    right: 20rpx;
    bottom: 150rpx;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12rpx;
    padding: 12rpx;
    z-index: 11;
    animation: fadeIn 0.2s ease;

    .definition-list {
      .definition-item {
        padding: 12rpx 24rpx;
        margin-bottom: 8rpx;
        border-radius: 6rpx;

        &:last-child {
          margin-bottom: 0;
        }

        &.active {
          background: rgba(129, 85, 240, 0.6);
        }

        .label {
          color: #fff;
          font-size: 26rpx;
          margin-bottom: 4rpx;
        }

        .desc {
          color: rgba(255, 255, 255, 0.7);
          font-size: 20rpx;
        }
      }
    }
  }

  .loading-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    z-index: 99;
  }
}


.error-mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 101;

  .error-content {
    text-align: center;
    padding: 20rpx;

    .error-text {
      color: #fff;
      font-size: 28rpx;
      margin-bottom: 20rpx;
    }

    .retry-btn {
      background: #fff;
      color: #333;
      font-size: 26rpx;
      padding: 10rpx 30rpx;
      border-radius: 8rpx;
      border: none;

      &:active {
        opacity: 0.8;
      }
    }
  }
}

// 添加淡入动画
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

// 添加淡出动画
.ad-container.hide {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}